package com.bbdjt.weixin.service.impl;

import java.util.List;


import org.springframework.stereotype.Service;
import tk.mybatis.mapper.entity.Example;
import tk.mybatis.mapper.util.StringUtil;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.bbdjt.weixin.model.HospitalQueryModel;
import com.bbdjt.weixin.base.service.impl.BaseServiceImpl;
import com.bbdjt.weixin.dao.HospitalDao;
import com.bbdjt.weixin.model.Hospital;
import com.bbdjt.weixin.service.HospitalService;

@Service("hospitalService")
public class HospitalServiceImpl extends BaseServiceImpl<Hospital> implements HospitalService {
	
	@Override
    public List<Hospital> selectByHospital(Hospital hospital, int page, int rows) {
        Example example = new Example(Hospital.class);
        Example.Criteria criteria = example.createCriteria();
        criteria.andEqualTo(hospital);
        PageHelper.startPage(page, rows);
        return selectByExample(example);
    }
    
    @Override
    public List<Hospital> selectByHospital(Hospital hospital) {
        Example example = new Example(Hospital.class);
        Example.Criteria criteria = example.createCriteria();
        criteria.andEqualTo(hospital);
        return selectByExample(example);
    }

    @Override
    public PageInfo<HospitalQueryModel> selectByHospitalQueryModel(HospitalQueryModel hospital) {
    	return ((HospitalDao) getMapper()).selectByHospitalModel(hospital);
    }

	@Override
	public List<Hospital> selectByHospital(HospitalQueryModel hospital) {
		  Example example = new Example(Hospital.class);
	        Example.Criteria criteria = example.createCriteria();
	        criteria.andEqualTo(hospital);
	        PageHelper.startPage(hospital.getPageNum(), hospital.getPageSize(),hospital.getOrderBy());
	        return selectByExample(example);
	}

	
}